package com.dajiba.demo

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.view.View
import androidx.fragment.app.Fragment
import com.blankj.utilcode.util.LogUtils
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        LogUtils.d("onCreate")

        val fragmens = arrayListOf<Fragment>()
        val tabNames = arrayListOf<String>()

        val views = arrayListOf<View>()
        views.add(CustomDrawBeatLine(this))
        views.add(TextScroll(this))
        views.add(CustomFillBg(this))
        views.add(ImageFmUserLikePortrait(this))
        views.add(CustomTextRound(this))
        val customNineView = CustomNineView(this)
        val strings = arrayListOf<String>()
        customNineView.setOnClickListener {
            strings.add("")
            customNineView.upData(strings)
        }
        views.add(customNineView)
        views.add(CustomDrawShadow(this))
        views.add(CustomWheelPicker(this))
        views.add(CustomDrawCake(this))
        views.add(CustomDrawColumn(this))
        views.add(CustomDrawPath(this))
        views.add(CustomDrawArc(this))
        views.add(CustomDrawRoundRect(this))
        for (view in views) {
            tabNames.add(view.javaClass.simpleName)
            fragmens.add(PageFragment().setChildView(view))
        }

        val viewPagerAdapter = ViewPagerAdapter(supportFragmentManager, tabNames, fragmens)
        viewpager.adapter = viewPagerAdapter
        tablayout.setupWithViewPager(viewpager)
    }
}
